import { createRouter, createWebHistory } from 'vue-router'
import layoutView from '../views/layout/index.vue'
import indexView from '../views/index/index.vue'
import clazzIndexView from '../views/clazz/index.vue'
import deptIndexView from '../views/dept/index.vue'
import empIndexView from '../views/emp/index.vue'
import empReportIndexView from '../views/report/emp/index.vue'
import stuReportIndexView from '../views/report/stu/index.vue'
import stuIndexView from '../views/stu/index.vue'
import loginIndexView from '../views/login/index.vue'
import logIndexView from '../views/log/index.vue'
import changePwdIndexView from '../views/changePassword/index.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: '',
      component: layoutView,
      redirect: '/login',  // path: '/'  重定向
      children: [
        { path: 'index', name: 'index', component: indexView },
        { path: 'clazzs', name: 'clazzs', component: clazzIndexView },
        { path: 'dept', name: 'depts', component: deptIndexView },
        { path: 'emps', name: 'emps', component: empIndexView },
        { path: 'empReport', name: 'empReport', component: empReportIndexView },
        { path: 'stuReport', name: 'stuReport', component: stuReportIndexView },
        { path: 'students', name: 'students', component: stuIndexView },
        { path: 'logReport', name: 'logReport', component: logIndexView },
      ]
    },

    { path: '/login', name: 'login', component: loginIndexView },
    { path: '/changePwd', name: 'changePwd', component: changePwdIndexView },
  ]
})

export default router
